package model;

import java.io.Serializable;
import javax.persistence.*;
import java.math.BigDecimal;
import java.util.List;


/**
 * The persistent class for the RAW_MATERIAL database table.
 * 
 */
@Entity
@Table(name="RAW_MATERIAL")
public class RawMaterial implements Serializable {
	private static final long serialVersionUID = 1L;

	@Id
	@Column(name="MATERIAL_ID")
	private long materialId;

	@Column(name="MATERIAL_NAME")
	private String materialName;

	@Column(name="MATERIAL_STANDARD_COST")
	private BigDecimal materialStandardCost;

	@Column(name="UNIT_OF_MEASURE")
	private String unitOfMeasure;

	//bi-directional many-to-one association to Supply
	@OneToMany(mappedBy="rawMaterial")
	private List<Supply> supplies;

	//bi-directional many-to-one association to Us
	@OneToMany(mappedBy="rawMaterial")
	private List<Us> uses;

	public RawMaterial() {
	}

	public long getMaterialId() {
		return this.materialId;
	}

	public void setMaterialId(long materialId) {
		this.materialId = materialId;
	}

	public String getMaterialName() {
		return this.materialName;
	}

	public void setMaterialName(String materialName) {
		this.materialName = materialName;
	}

	public BigDecimal getMaterialStandardCost() {
		return this.materialStandardCost;
	}

	public void setMaterialStandardCost(BigDecimal materialStandardCost) {
		this.materialStandardCost = materialStandardCost;
	}

	public String getUnitOfMeasure() {
		return this.unitOfMeasure;
	}

	public void setUnitOfMeasure(String unitOfMeasure) {
		this.unitOfMeasure = unitOfMeasure;
	}

	public List<Supply> getSupplies() {
		return this.supplies;
	}

	public void setSupplies(List<Supply> supplies) {
		this.supplies = supplies;
	}

	
	public Supply addSupplies(Supply supplies) {
		getSupplies().add(supplies);
		supplies.setRawMaterial(this);

		return supplies;
	}

	public Supply removeSupplies(Supply supplies) {
		getSupplies().remove(supplies);
		supplies.setRawMaterial(null);

		return supplies;
	}
	public List<Us> getUses() {
		return this.uses;
	}

	public void setUses(List<Us> uses) {
		this.uses = uses;
	}

	
	public Us addUses(Us uses) {
		getUses().add(uses);
		uses.setRawMaterial(this);

		return uses;
	}

	public Us removeUses(Us uses) {
		getUses().remove(uses);
		uses.setRawMaterial(null);

		return uses;
	}
}